package mylab.io.base.model;

import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import mylab.io.base.property.ProtocolAttrs;

@Getter
@Setter
@ToString
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class Terminal implements Endpoint {

    //通信端点
    protected Endpoint endpoint;

    //所属das,运行时动态赋值
    protected String dasId;
    //所属协议,运行时动态赋值
    protected ProtocolAttrs protocol;

    public Terminal(Endpoint endpoint) {
        this.endpoint = endpoint;
    }


    @JsonIgnore
    @EqualsAndHashCode.Include
    @Override
    public String getId() {
        return endpoint != null ? endpoint.getId() : null;
    }
}
